from typing import Any
import scrapy
from scrapy.http import Response


class QuotesSpider(scrapy.Spider):
    name = "quotes"

    start_urls = [
        "https://quotes.toscrape.com/",
    ]

    def parse(self, response: Response, **kwargs: Any) -> Any:
        # next_page = response.css("ul.pager li.next a")
        # yield from response.follow_all(next_page, self.parse)

        for quote in response.css("div.quote"):
            yield {
                "text": quote.css("span.text::text").get(),
                "author": quote.css("small.author::text").get(),
                "tags": quote.css("div.tags a.tag::text").getall(),
            }
